<%@language=vbscript%>
 <%
	Session("FormName")="F23"
	Session("VanBan")=""
%>
<!--#include file="..\CheckSession.inc"-->
<!--#include file="..\RootContent.inc"-->
<!--#include file=..\getFormName.inc-->
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>New Page 1</title>
</head>
<!--#include file="..\Jvgrid.inc"-->
<%	
	bComm=Request("bComm")	
	bnam=Request("bNam")
	' HienSX	
	sort=request("sort")
	if sort="" then sort="RevDate"
	Select case sort
		Case "Date":
			oSQL=" order by ngayky,soghinhan"
			bImgDate="../Images/up.gif"
			bImgSymbol=""
			bImgSubject=""
		Case "RevDate":
			oSQL=" order by ngayky DESC,soghinhan DESC"
			bImgDate="../Images/down.gif"
			bImgSymbol=""
			bImgSubject=""
		Case "Symbol":
			oSQL=" order by soghinhan,ngayky"
			bImgDate=""
			bImgSymbol="../Images/up.gif"
			bImgSubject=""
		Case "RevSymbol":
			oSQL=" order by soghinhan DESC,ngayky DESC"
			bImgDate=""
			bImgSymbol="../Images/down.gif"
			bImgSubject=""
		Case "Subject":
			oSQL=" order by Trichyeu,ngayky,soghinhan"
			bImgDate=""
			bImgSymbol=""
			bImgSubject="../Images/up.gif"
		Case "RevSubject":
			oSQL=" order by Trichyeu DESC,ngayky DESC,soghinhan DESC"
			bImgDate=""
			bImgSymbol=""
			bImgSubject="../Images/down.gif"
		Case "Attach":
			oSQL=" order by attach"
			bImgDate=""
			bImgNum=""
			bImgSymbol=""
			bImgSubject=""		
		Case "RevAttach":
			oSQL=" order by attach DESC"
			bImgDate=""
			bImgNum=""
			bImgSymbol=""
			bImgSubject=""			
	End Select

	Select case bComm
		case "delete"
			if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin")then
				bSogoc=request("TxtSogoc")
				bSoghinhan=request("TxtSoghinhan")
				bTentep=Request("TxtTentep")
				bID=request("bID")
				'Kiem tra xoa lien quan den muontratailieu
				sSQL="Select * from muontra where Trangthaimuon=1 and loaitailieu like '3' and  matailieu like '"& modistring(bSoghinhan) &"'"
				Set RecKTMuon=server.CreateObject("ADODB.Recordset")
				RecKTMuon.CursorType=3
				RecKTMuon.CacheSize=5
				RecKTMuon.Open sSQL,Conn
				bNotDel=false
				if RecKTMuon.RecordCount then
					bNotDel=true
				end if
				RecKTMuon.Close
				Set RecKTMuon=nothing
				'Bat dau xoa			
				'Tao Transaction
				if not bNotDel then
				On Error Resume Next
				Conn.BeginTrans	
				sSQL="Select * from vanban_Noidung where Mavanthu like '"& modistring(bID) &"' and Loaivanthu like '4'"
				set RecNoidung=server.CreateObject("ADODB.Recordset")
				RecNoidung.CursorType=3
				RecNoidung.CacheSize=5
				RecNoidung.Open sSQL,Conn
				Set File = Server.CreateObject("ActiveFile.File")
				bNam=Request("bnam")
				do while not RecNoidung.EOF
					p=RootContent & "Upload\"& cstr(bnam) &"\Noibo"
					p=p & "\"& RecNoidung("Tentep")
					File.Name=p
					if File.Exists() then
						File.Delete()
					end if
					RecNoidung.MoveNext
					if Err.number<>0 then
						exit Do
					end if
				Loop			
				'Xoa bang vanban_noidung
				RecNoidung.Close
				set RecNoidung=nothing
				sSQL="Delete from vanban_Noidung where Mavanthu like '"& modistring(bID) &"' and Loaivanthu like '4'"
				Conn.Execute sSQL			
				p=RootContent & "Upload\"& cstr(bNam) &"\Noibo\Text"
				p=p & "\" & bID & ".VT"
				File.Name=p
				if File.Exists() then
					File.Delete()
				end if
				set File=nothing			
				'Xoa bang vtnoibo
				sSQL="Delete from VTNoibo where IDNoibo like '"& modistring(bID) &"'"
				Conn.Execute sSQL
				%><%=Err.Description%><%
				if Err.number=0 then
					Conn.CommitTrans
					bTrangthai=1
				else
					Conn.RollbackTrans
					bTrangthai=0
				end if
				'Ghi nhan Ai da login thanh cong				
				bTrangthailog=1
				bHoten=Session("bHoten")
				bNgaygio=cstr(Date()) &" "& cstr(Time())
				bChucnang="C&#7853;p nh&#7853;t V&#259;n n&#7897;i b&#7897;"
				bIDTailieu=bSoghinhan
				bDongtac="Xo&#225;"
				sSQL="insert into loguser(Tennguoisudung,ngaygio,chucnangdung,dongtac,IDTailieu,Trangthai) Values('"& bHoten _
					&"','"& bNgaygio &"','"& bChucnang &"','"& bDongtac &"','"& bIDTailieu &"','"& bTrangthailog &"')"
				Conn.Execute sSQL
				else
					bMsg="M&#227; v&#259;n th&#432; &#273;ang &#273;&#432;&#7907;c li&#234;n k&#7871;t kh&#244;ng th&#7875; xo&#225; &#273;&#432;&#7907;c"
				end if
				if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then
					sSQL="Select VTNoibo.* from VTNoibo" & oSQL
				else
					btcu="SELECT Quyen_Nhom.Mavanthu FROM Canbo INNER JOIN Canbo_Nhom ON Canbo.Macanbo =Canbo_Nhom.Macanbo INNER JOIN Nhom ON dbo.Canbo_Nhom.Manhom=Nhom.Manhom INNER JOIN Quyen_Nhom ON Nhom.Manhom =Quyen_Nhom.MaNhom WHERE (Canbo.Macanbo = '"& Session("bMaCB") &"') and Quyen_nhom.maloaivanthu like '3'"

					bt="SELECT Quyen_Nhom.Mavanthu FROM donvi inner join quyen_nhom on donvi.id = quyen_nhom.manhom where donvi.madonvi like '"& Session("bMaDonVi") &"' And Quyen_nhom.maloaivanthu like '3'"
					if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" then
						sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ( VTNoibo.quyen=1 ) or (VTNoibo.quyen=0 and donvixuly like '"& Session("bMaDonVi") &"') or (VTNoibo.quyen=0 and (VTNoibo.soghinhan in ("& btcu &")))" & oSQL
					else
						if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),5)="1" then
							sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& btcu &")) or (VTNoibo.soghinhan in ("& bt &")) or (donvixuly like '"& Session("bMaDonVi") &"') or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 " & oSQL
						else
							sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& btcu &")) or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 " & oSQL
						end if
					end if
				end if			
			end if
		case "search"
			bSoghinhan=request("TxtSogoc")
			bTukhoa=Request("TxtTukhoa")
			bTungay=Request("TxtTungay")
			bDenngay=Request("TxtDenNgay")
			bTrichyeu=Request("TxtTrichyeu")
			btcu="SELECT Quyen_Nhom.Mavanthu FROM Canbo INNER JOIN Canbo_Nhom ON Canbo.Macanbo =Canbo_Nhom.Macanbo INNER JOIN Nhom ON dbo.Canbo_Nhom.Manhom=Nhom.Manhom INNER JOIN Quyen_Nhom ON Nhom.Manhom =Quyen_Nhom.MaNhom WHERE (Canbo.Macanbo = '"& Session("bMaCB") &"') and Quyen_nhom.maloaivanthu like '3'"
			if (bTungay<>"" and bDenNgay<>"") then
				if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then
					sSQL="Select * from VTNoibo where Soghinhan like '%"& Modistring(bSoghinhan) &"%'"
					sSQL=sSQL+" And Tukhoa Like '%"& Modistring(bTukhoa) &"%'"
					sSQL=sSQL+" And Trichyeu Like '%"& Modistring(bTrichyeu) &"%'"
					sSQL=sSQL+" And ( Ngayky Between '"& SaveDate(bTungay) &"' And '"& SaveDate(bDenngay) &"') " & oSQL
				else
					bt="SELECT Quyen_Nhom.Mavanthu FROM donvi inner join quyen_nhom on donvi.id = quyen_nhom.manhom where donvi.madonvi like '"& Session("bMaDonVi") &"' And Quyen_nhom.maloaivanthu like '3'"
					if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" then
						sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ( VTNoibo.quyen=1 ) or (VTNoibo.quyen=0 and donvixuly like '"& Session("bMaDonVi") &"') or (VTNoibo.quyen=0 and (VTNoibo.soghinhan in ("& btcu &"))) "
					else
						if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),5)="1" then
							sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& btcu &")) or (VTNoibo.soghinhan in ("& bt &")) or (donvixuly like '"& Session("bMaDonVi") &"') or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 "
						else
							sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& btcu &")) or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 "
						end if
					end if
					'sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& bt &")) or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 "
					sSQL=sSQL+" And Soghinhan like '%"& Modistring(bSoghinhan) &"%'"
					sSQL=sSQL+" And Tukhoa Like '%"& Modistring(bTukhoa) &"%'"
					sSQL=sSQL+" And Trichyeu Like '%"& Modistring(bTrichyeu) &"%'"
					sSQL=sSQL+" And ( Ngayky Between '"& SaveDate(bTungay) &"' And '"& SaveDate(bDenngay) &"') " & oSQL
				end if
			else
				if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then
					sSQL="Select * from VTNoibo where soghinhan like '%"& Modistring(bSoghinhan) &"%'"
					sSQL=sSQL+" And Tukhoa Like '%"& Modistring(bTukhoa) &"%'"
					sSQL=sSQL+" And Trichyeu Like '%"& Modistring(bTrichyeu) &"%' " & oSQL
				else
					bt="SELECT Quyen_Nhom.Mavanthu FROM donvi inner join quyen_nhom on donvi.id = quyen_nhom.manhom where donvi.madonvi like '"& Session("bMaDonVi") &"' And Quyen_nhom.maloaivanthu like '3'"
					if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" then
						sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ( VTNoibo.quyen=1 ) or (VTNoibo.quyen=0 and donvixuly like '"& Session("bMaDonVi") &"') or (VTNoibo.quyen=0 and VTNoibo.soghinhan in ("& btcu &")))"
					else
						if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),5)="1" then
							sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& btcu &")) or (VTNoibo.soghinhan in ("& bt &")) or (donvixuly like '"& Session("bMaDonVi") &"') or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 "
						else
							sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& btcu &")) or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 "
						end if
					end if
					'sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& bt &")) or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 "
					sSQL=sSQL+" And soghinhan like '%"& Modistring(bSoghinhan) &"%'"
					sSQL=sSQL+" And Tukhoa Like '%"& Modistring(bTukhoa) &"%'"
					sSQL=sSQL+" And Trichyeu Like '%"& Modistring(bTrichyeu) &"%' " & oSQL
				end if
			end if
		Case else
			if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then
				sSQL="Select * from VTNoibo " & oSQL
			else
				btcu="SELECT Quyen_Nhom.Mavanthu FROM Canbo INNER JOIN Canbo_Nhom ON Canbo.Macanbo =Canbo_Nhom.Macanbo INNER JOIN Nhom ON dbo.Canbo_Nhom.Manhom=Nhom.Manhom INNER JOIN Quyen_Nhom ON Nhom.Manhom =Quyen_Nhom.MaNhom WHERE (Canbo.Macanbo = '"& Session("bMaCB") &"') and Quyen_nhom.maloaivanthu like '3'"
				bt="SELECT Quyen_Nhom.Mavanthu FROM donvi inner join quyen_nhom on donvi.id = quyen_nhom.manhom where donvi.madonvi like '"& Session("bMaDonVi") &"' And Quyen_nhom.maloaivanthu like '3'"
				if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" then
					sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ( VTNoibo.quyen=1 ) or (VTNoibo.quyen=0 and donvixuly like '"& Session("bMaDonVi") &"') " & oSQL
				else
					if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),5)="1" then
						sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& btcu &")) or (VTNoibo.soghinhan in ("& bt &")) or (donvixuly like '"& Session("bMaDonVi") &"') or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 " & oSQL
					else
						sSQL="SELECT VTNoibo.* FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and (VTNoibo.soghinhan in ("& btcu &"))) or  (VTNoibo.quyen=0 and (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3')))) and trangthai=1 " & oSQL
					end if
				end if
			end if
	end select
	bPrintValue=sSQL
	Set Rec=server.CreateObject("ADODB.Recordset")
	Rec.CursorType=3
	Rec.CacheSize=5
	'Rec.Open ssql,Conn	
	
	Dim nRecCount	' Number of records found
	Dim nPageCount	' Number of pages of records we have
	Dim nPage	' Current page number
	nPage=CLng(request("Page"))	
	if nPage="" then nPage=1
	rec.Open ssql,Conn
	if  rec.EOF and rec.BOF then
		nPageCount=0
	end if	
	
	bDisplay=Request("bDisplay")
	if  bDisplay then
		if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin")then
			sSQL="Select * from VTNoibo where IDNoibo like "& request("bID") 
		else
			bt="SELECT Quyen_Nhom.Mavanthu FROM Canbo INNER JOIN Canbo_Nhom ON Canbo.Macanbo =Canbo_Nhom.Macanbo INNER JOIN Nhom ON dbo.Canbo_Nhom.Manhom=Nhom.Manhom INNER JOIN Quyen_Nhom ON Nhom.Manhom =Quyen_Nhom.MaNhom WHERE (Canbo.Macanbo = '"& Session("bMaCB") &"') and Quyen_nhom.maloaivanthu like '3'"

			sSQL="SELECT * FROM VTNoibo WHERE ((VTNoibo.quyen=1) or  (VTNoibo.quyen=0 and ((VTNoibo.soghinhan in ("& bt &")) or (VTNoibo.soghinhan  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='3'))))) and trangthai=1 and IDNoibo like "& request("bID")
			
		end if
		sSQL="Select * from VTNoibo where IDNoibo like "& request("bID")
		Set RecDisplay=Server.CreateObject("ADODB.Recordset")
		RecDisplay.CursorType=3
		RecDisplay.CacheSize=5
		RecDisplay.Open sSQL,Conn
		if RecDisplay.RecordCount>0 then
			bSoghinhan=RecDisplay("Soghinhan")
			bID=RecDisplay("IDNoibo")
			bNgayKy=RecDisplay("Ngayky")
			bTukhoa=RecDisplay("Tukhoa")
			bTrichyeu=RecDisplay("TRichyeu")
			bChophep=RecDisplay("quyen")
			bTenTep=RecDisplay("Tentep")
		end if
		RecDisplay.Close
		set RecDisplay=nothing
	end if
%>	
<%	if request("chuachon")="thongtin" then%>
		<p align=center><font color=red>Báº¡n cáº§n chá»n Ä‘Ãºng thÃ´ng tin cáº§n sá»­a</font></p>
<%	end if
%>
<!--#include file="..\jvfunction.inc"-->
<script language=VBScript runat=server>
	' H&#224;m &#273;&#7883;nh d&#7841;ng l&#7841;i ng&#224;y M/D/Y-> D/M/Y
	Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
	End Function
	Function ModiString(mess_s)
		message = Replace("" & mess_s,"'", "''")
		ModiString=message
	End function
	Function SaveDate(vDate)
		dim bvitri1
		dim bvitri2
	   vDate=trim(cstr(vDate))
	   bvitri1=instr(1,vDate,"/")
	   bMonth=left(vDate,bvitri1-1)
	   bvitri2=instr(bvitri1+1,vDate,"/")
	   Dim Temp
	   Temp=right(vDate,len(vDate)-bvitri1)
	   bDay=left(Temp,bvitri2-bvitri1-1)
	   bYear=right(vDate,len(vDate)-bvitri2)
       SaveDate=bDay+"/"+bMonth+"/"+bYear
	End Function	
</script>	
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
//HienSX
function Sort(SortKey){
	if (document.Noidung.Sort.value.indexOf(SortKey)== -1)
		document.Noidung.Sort.value=SortKey;
	else {
		if (document.Noidung.Sort.value.indexOf('Rev')== -1)
			document.Noidung.Sort.value='Rev' + SortKey;
		else
			document.Noidung.Sort.value= SortKey;
	}
	Noidung.target="right"
	Noidung.action="frmdsVTNoibo.asp?sort=" + Noidung.Sort.value;
	Noidung.submit();
}

function SetFocus(){
	window.Noidung.CmdSearch.focus();
}

function CmdAdd_onclick() {
	window.Noidung.target="right"
	window.Noidung.action="frmVTnoibo.asp?bComm=add&sort=" + Noidung.Sort.value;	window.Noidung.submit();
}

function CmdEdit_onclick() {
	if (Noidung.bID.value==""){
		alert("Cho biết thông tin cần sửa");
		return false;
	}
	Noidung.TxtSogoc.disabled=false
	Noidung.TxtTrichyeu.disabled=false
	Noidung.TxtTuKhoa.disabled=false
	window.Noidung.target="right"
	window.Noidung.action="frmVTnoibo.asp?bComm=edit";
	window.Noidung.submit();
}
function CmdPrint_onclick() {
/*
	if (Noidung.TxtTungay.disabled){
		Noidung.CmdDelete.disabled=true;
		Noidung.CmdEdit.disabled=true;
		Noidung.CmdSearch.disabled=true;
		
		Noidung.TxtDenngay.disabled=false;
		Noidung.TxtTungay.disabled=false;
		Noidung.TxtDenngay.value="";
		Noidung.TxtTungay.value="";
		Noidung.TxtSogoc.value="";
		Noidung.TxtTuKhoa.value="";
		Noidung.TxtTrichyeu.value="";
		Noidung.TxtTungay.focus();
		return false;
	}
	if(Noidung.TxtTungay.value!=""){
		if (!isDate(Noidung.TxtTungay.value)){
			alert("Ngày không hợp lệ");
			Noidung.TxtTungay.focus();
			return false;
		}
		else
			if(trim(Noidung.TxtDenngay.value)==""){
				alert("Cho biết đến ngày");
				Noidung.TxtDenngay.focus();
				return false;
			}
	}
	if(Noidung.TxtDenngay.value!=""){	
		if (!isDate(Noidung.TxtDenngay.value)){
			alert("Ngày không hợp lệ");
			Noidung.TxtDenngay.focus();
			return false;
		}
		else
			if(trim(Noidung.TxtTungay.value)==""){
				alert("Cho biết từ ngày");
				Noidung.TxtDenngay.focus();
				return false;
			}
	}
	Noidung.TxtSogoc.disabled=true
	Noidung.TxtTrichyeu.disabled=true
	Noidung.TxtTuKhoa.disabled=true	
	Noidung.CmdSearch.disabled=false;
	bBegin=prompt("Đánh số thứ tự từ: ","");
	
	Noidung.target="_blank";
	Noidung.action="FrmPrintNB.asp";
	Noidung.submit();
	Noidung.TxtDenngay.disabled=true;
	Noidung.TxtTungay.disabled=true;
*/
if(trim(Noidung.PrintValue.value)!=""){
	Noidung.target="_blank";
	Noidung.action="FrmPrintNB.asp";
	Noidung.submit();
	Noidung.TxtDenngay.disabled=true;
	Noidung.TxtTungay.disabled=true;
}
}
function CmdSearch_onclick() {
	if (Noidung.TxtSogoc.disabled){
		Noidung.CmdDelete.disabled=true;
		Noidung.CmdEdit.disabled=true;
		Noidung.CmdPrint.disabled=true;
		
		Noidung.CmdSearch.value="Tì<u>m</u>";
		Noidung.TxtSogoc.disabled=false;
		Noidung.TxtDenngay.disabled=false;
		Noidung.TxtTuKhoa.disabled=false;
		Noidung.TxtTungay.disabled=false;
		Noidung.TxtTrichyeu.disabled=false;
		Noidung.TxtSogoc.value="";
		//Noidung.TxtDenngay.value="<%=Formatdate(Date())%>";
		Noidung.TxtDenngay.value="";
		Noidung.TxtTuKhoa.value="";
		//Noidung.TxtTungay.value="<%=Formatdate(Date()-90)%>";
		Noidung.TxtTungay.value="";
		Noidung.TxtTrichyeu.value="";
		
		Noidung.TxtSogoc.focus();
		return false;
	}
	if(Noidung.TxtTungay.value!=""){
		if (!isDate(Noidung.TxtTungay.value)){
			alert("Ngày không hợp lệ");
			Noidung.TxtTungay.focus();
			return false;
		}
		else
			if(trim(Noidung.TxtDenngay.value)==""){
				alert("Cho biết đến ngày");
				Noidung.TxtDenngay.focus();
				return false;
			}
	}
	if(Noidung.TxtDenngay.value!=""){	
		if (!isDate(Noidung.TxtDenngay.value)){
			alert("Ngày không hợp lệ");
			Noidung.TxtDenngay.focus();
			return false;
		}
		else
			if(trim(Noidung.TxtTungay.value)==""){
				alert("Cho biết từ ngày");
				Noidung.TxtDenngay.focus();
				return false;
			}
	}
	bsg=Noidung.TxtSogoc.value;
	btn=Noidung.TxtTungay.value;
	bdn=Noidung.TxtDenngay.value;
	bty=Noidung.TxtTrichyeu.value;
	btk=Noidung.TxtTuKhoa.value;
	window.Noidung.target="right"
	window.Noidung.action="frmdsvtnoibo.asp?bComm=search";
	window.Noidung.submit();
}
function Row_Click(Sogoc,Tukhoa,Tungay,Trichyeu,Tentep,soghinhan){
	document.Noidung.TxtSogoc.value=Sogoc;
	document.Noidung.TxtTuKhoa.value=Tukhoa;
	document.Noidung.TxtTungay.value=Tungay;
	document.Noidung.TxtDenngay.value=Tungay;
	document.Noidung.TxtTrichyeu.value=Trichyeu;
	document.Noidung.TxtTentep.value=Tentep;
	document.Noidung.TxtSoghinhan.value=soghinhan;
}
function CmdNoidung_onclick() {
	if (Noidung.bID.value!=""){
		window.Noidung.target="new";
		window.Noidung.action="xemnoidung.asp?LoaiVt=4&bMa="+"<%=request("bID")%>"
		window.Noidung.submit();
	}
	else{
		alert("Bạn hãy chọn thông tin cần xem");
	}
	
	
}
function CmdDelete_onclick() {	
	if (Noidung.bID.value!=""){
		if(!confirm("Bạn có muốn xóa không ?")){
			return false;	
		}
		window.Noidung.target="right"
		window.Noidung.action="frmdsvtnoibo.asp?page="+"<%=nPage%>"+"&bComm=delete"+"&bNam="+"<%=bNam%>";
		window.Noidung.submit();
	}
	else{
		alert("Bạn hãy chọn thông tin cần xoá");
	}
}
function CmdNoidungtep_onclick() {
	if(Noidung.bID.value==""){
		alert("Cho biáº¿t vÄƒn báº£n");
		return false;
	}
	<%if bQuyen="" or bQuyen="R" then%>
		alert("B&#7841;n kh&#244;ng c&#243; quy&#7873;n thay &#273;&#7893;i n&#7897;i dung &#273;&#7889;i v&#7899;i v&#259;n th&#432; n&#224;y");
		return false;
	<%end if%>
	window.Noidung.target="right"
	window.Noidung.action="upload.asp?filename="+Noidung.TxtTentep.value;
	window.Noidung.submit();
}

function CmdXemquyen_onclick() {
//		window.Noidung.action="XemQuyen.asp?LoaiVt=3&bMa="+"<%=bSoghinhan%>"+"&bSoVB="+"<%=bSoghinhan%>";
if (Noidung.bID.value!=""){
		window.Noidung.target="right";
		window.Noidung.action="duyetcanbodvxl.asp?bstepduyet=0&MaVT="+"<%=bSoghinhan%>"+"&bMaLoaiVT=3";
		window.Noidung.submit();
	}		
}


function TxtTungay_onkeyup(str){
var keycode
keycode=window.event.keyCode
if (isEdit(keycode,str)){
	Noidung.TxtTungay.value=editdate(trim(str))
}
}

function TxtDenngay_onkeyup(str){
var keycode
keycode=window.event.keyCode
if (isEdit(keycode,str)){
	Noidung.TxtDenngay.value=editdate(trim(str))
}
}
function CmdWorklow_onclick()
{
	if(Noidung.TxtSogoc.value=="")
	{
		alert("Bạn hãy chọn quyết định cần xử lý");
		return false;
	}
	if(!confirm("Bạn có muốn tạo luồng xử lý ?")){
	  return false;
	}
	window.Noidung.target="right";
	window.Noidung.action="../workflow/createworkflow.asp?bComm=vtnoibo";
	window.Noidung.submit();
}
//-->
</SCRIPT>
<LINK href="../styles/styles.css" type=text/css rel=STYLESHEET>
<body bgcolor=#F8F9D9 leftmargin=2 topmargin=0 onload="SetFocus()">
<%if bMsg<>"" then%>
	<p align=center><font color=red><%=bMsg%>
<%end if%>
<form name="Noidung" method="post">
<Input TYPE="hidden" name="Sort" value="<%=sort%>">
<INPUT TYPE="hidden" name=PrintValue value="<%=bPrintValue%>">
  <table border="0" width="100%" bgcolor="#BDD5D0" style="Font-family:Times New Roman; font-size:12pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0" cellspacing=0 cellpadding=0>
	<%if bDisplay then%>
		<Input type=hidden name=TxtTentep value='<%=bTentep%>'>
		<Input type=hidden name=TxtSoghinhan value='<%=bSoghinhan%>'>
		<input name=bID type=hidden value='<%=bID%>'>
	<%else%>
		<Input type=hidden name=TxtTentep>
		<Input type=hidden name=TxtSoghinhan>
		<input name=bID type=hidden>
	<%end if%>
    <tr>
      <TD WIDTH="100%" COLSPAN="6" BGCOLOR="#000080" ALIGN="CENTER"><font size=3 color="#FFFFFF" face="Times new roman">VĂN BẢN NỘI BỘ</font></TD>
    </tr>
    <tr>
      <td width="15%"><p align=center>Số ghi nhận</p></td>
      <td width="25%">
		<%if bDisplay then%>
			<input type="text" name="TxtSogoc" value='<%=bSoghinhan%>' Disabled=true size="24" style="width:100%"></td>
		<%else%>
			<input type="text" name="TxtSogoc" Disabled=true size="24" style="width:100%"></td>
		<%end if%>
      <td width="15%" align=center>Từ ngày<BR>(ngày ký)</td>
      <td width="15%">
		<%if bDisplay then%>
			<input type='text' name='TxtTungay' value='<%=FormatDate(bNgayky)%>' Disabled=true size="15" maxlength=10 LANGUAGE=javascript onkeyup="return TxtTungay_onkeyup(this.value)" style="width:100%"></td>
		<%else%>
			<input type="text" name="TxtTungay" size="15" maxlength=10 Disabled=true LANGUAGE=javascript onkeyup="return TxtTungay_onkeyup(this.value)" style="width:100%"></td>
		<%end if%>
      <td width="15%" align=center>Đến ngày <BR>(ngày ký)</td>
      <td width="15%">
		<%if bDisplay then%>
			<input type="text" name="TxtDenngay" value='<%=FormatDate(bNgayky)%>' Disabled=true size="15" maxlength=10 LANGUAGE=javascript onkeyup="return TxtDenngay_onkeyup(this.value)"style="width:100%"></td>
		<%else%>
			<input type="text" name="TxtDenngay" Disabled=true size="15" maxlength=10 LANGUAGE=javascript onkeyup="return TxtDenngay_onkeyup(this.value)" style="width:100%"></td>
		<%end if%>
      </tr>
      <tr>
        <td width="15%" align=center>Từ khóa</td>
        <td width="25%">
        <%if bDisplay then%>
			<input type="text" name="TxtTuKhoa" value='<%=bTukhoa%>' Disabled=true size="24" style="width:100%"></td>
		<%else%>
			<input type="text" name="TxtTuKhoa" Disabled=true size="24" style="width:100%"></td>
		<%end if%>
        <td width="15%"><p align=center>Trích yếu</p></td>
        <td width="45%" colspan="3">
        <%if bDisplay then%>
			<textarea name="TxtTrichyeu" Disabled=true style="font-family:Arial; width:100%" rows=1 cols=54><%=bTrichyeu%></textarea></td>
		<%else%>
			<textarea name="TxtTrichyeu" Disabled=true style="font-family:Arial; width:100%" rows=1 cols=54></textarea></td>
		<%end if%>
      </tr>
</table>
<!-- Buttons -->
<table border="0" width="100%" bgcolor="#BDD5D0" cellspacing=0 bordercolorlight="#000000" bordercolordark="#808080" style="Font-family:Arial;font-size:11pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0">
	<tr>
	    <td width="14%">
		   <%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then%>
   				<Button name="CmdAdd" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><u>T</u>hêm</Button>
			<%else%>
   				<Button name="CmdAdd" disabled=true style="  height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><u>T</u>hêm</Button>
		   <% end if%>   			
	    </td>
    	<td width="14%">
	      <%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then%>
				<%if bDisplay then%>
					<Button name="CmdEdit" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button>
				<%else%>
					<Button disabled name="CmdEdit" style="height: 25; position: relative; width: 100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button>
				<%end if%>
		  <%else%>
				<Button disabled name="CmdEdit" style="height: 25; position: relative; width: 100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button>
		  <%end if%>
	    </td>
   		<td width="14%">
		  <%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then%>
				<%if bDisplay then%>
					<Button name="CmdDelete" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button>
				<%else%>
					<Button disabled name="CmdDelete" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button>
				<%end if%>
   		  <% else%>
	   			<Button name="CmdDelete" disabled=true style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button>
   		  <% end if%>   		  
   		 </td>
   		 
  		<td width="16%">
		<%if bChophep then%>
			<Button disabled=true name="CmdXemquyen" style="height: 25; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdXemquyen_onclick()" accesskey="C"><p><u>C</u>ông cộng</p></Button></td>
		<%else%>
			<%if bDisplay then%>
				<% if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),5)="1" or Session("IsAdmin") then	%>
					<Button name="CmdXemquyen" style="height: 25; width:100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdXemquyen_onclick()" accesskey="P"><p><u>P</u>hân quyền</p></Button></td>
	   		  <% else%>
					<Button disabled name="CmdXemquyen" style="height:25; width:100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdXemquyen_onclick()" accesskey="P"><p><u>P</u>hân quyền</p></Button></td>
	   		  <% end if%>
			<%else%>
				<Button disabled  name="CmdXemquyen" style="height:25; width:100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdXemquyen_onclick()" accesskey="P"><p><u>P</u>hân quyền</p></Button></td>
			<%end if%>
		<%end if%>
   		  <td width="17%">
   		  <%if bDisplay then%>
			 <%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),7)="1" or Session("IsAdmin") then%> 
				 <Button name="CmdWorklow" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdWorklow_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
			 <%else%>
				 <Button name="CmdWorklow" disabled style="  height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdWorklow_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
			 <%end if%>
		 <%else%>
				<Button name="CmdWorklow" disabled style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdWorklow_onclick()" accesskey="a"><p>T<u>ạ</u>o luồng xử lý</p></Button>
		<%end if%>
		 </td>		 
   		 <td width="12%">
			 <%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),3)="1" or Session("IsAdmin") then%> 
				 <Button name="CmdPrint" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdPrint_onclick()" accesskey="I"><u>I</u>n</Button>
			 <%else%>
				 <Button name="CmdPrint" disabled=true style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdPrint_onclick()" accesskey="I"><u>I</u>n</Button>
			 <%end if%>
		 </td>
	   	 <td width="14%"><Button name="CmdSearch" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdSearch_onclick()" accesskey="M"><p>Tì<u>m</u> kiếm</p></Button></td>
	  </tr>
</table>
<!-- Danh sach van thu noi bo -->  
<table border="0" width="100%" style="Border-color:#C0C0C0;BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid">
	<tr bgcolor="#BDD5D0">
		<td width="5%"></td>
      <td width="1%" align="center"><A onmouseover="window.status='';return true" HREF="javascript:Sort('Attach')">&nbsp;<IMG border=0 SRC=../images/attach.gif>&nbsp;</A></td>		  
		
        <td width="20%" nowrap><A onmouseover="window.status='';return true" HREF="javascript:Sort('Symbol')">&nbsp;<b>Số ghi nhận</b>&nbsp;&nbsp;&nbsp;
	  <% if bImgSymbol<>"" then %><IMG SRC="<%=bImgSymbol%>" BORDER=0><%end if%> </A></td>
		<td width="15%" nowrap><A onmouseover="window.status='';return true" HREF="javascript:Sort('Date')">&nbsp;<b>Ngày ký</b>&nbsp;&nbsp;&nbsp;
	  <% if bImgDate<>"" then %><IMG SRC="<%=bImgDate%>" BORDER=0><%end if%> </A></td>
		<td width="60%" nowrap><A onmouseover="window.status='';return true" HREF="javascript:Sort('Subject')">&nbsp;<b>Trích yếu</b>&nbsp;&nbsp;&nbsp;
	  <% if bImgSubject<>"" then %><IMG SRC="<%=bImgSubject%>" BORDER=0><%end if%></A></td>
   <% 
	cnt=0
	If Not Rec.Eof Then
		nRecCount = Rec.RecordCount
		Rec.PageSize = 20
		nPageCount = Rec.PageCount
		If nPage < 1 then
			nPage = 1			
		End If
		if nPage > nPageCount Then
			nPage=nPageCount
		end if
		cnt=(pg-1)*pgsize + 1		    
		STT=1
		rec.AbsolutePage=nPage
		howmanyrecs=0
		do while not Rec.EOF and howmanyrecs<rec.PageSize
			if (cnt/2=int(cnt/2)) then
				color="#eeeecc"
			else
				color="#F8F9D9"
			end if
			
			if rec("attach") then
				imagesAttach="<IMG border=0 SRC=../images/attach.gif>"
			else				
				imagesAttach=""
			end if			
%>
	<%if cstr(Rec("IDNoibo"))=Request("bID") then
			color="#BDD7D6"
		end if%>
		<%if Rec("trangthai") then%>
      <tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" 
 onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<td width="5%"><font face='Arial'><a style='cursor:hand;text-decoration: none' href="xemnoidung.asp?LoaiVt=4&bMa=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></font></td>
		<td width="1%"><font face='Arial'><a style='cursor:hand;text-decoration: none' href="xemnoidung.asp?LoaiVt=4&bMa=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><%=imagesAttach%></p></a></font></td>

        <td width="20%"><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTNoibo.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>"><%=Rec("soghinhan")%></a></td>
        
		<td width="15%" align=center><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTNoibo.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>"><%=FormatDate(Rec("ngayky"))%></a></td>
		
		<td width="60%"><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTNoibo.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>"><%=Rec("trichyeu")%></a></td>
      </tr>
      <%else%>
      <tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" 
 onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<td width="5%"><font face='Arial'><a style='cursor:hand;text-decoration: none' href="xemnoidung.asp?LoaiVt=4&bMa=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></font></td>
		<td width="1%"><font face='Arial'><a style='cursor:hand;text-decoration: none' href="xemnoidung.asp?LoaiVt=4&bMa=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><%=imagesAttach%></p></a></font></td>        
        
		<td width="20%"><a style='cursor:hand;color:red;text-decoration: none' href="frmdsVTNoibo.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>"><%=Rec("soghinhan")%></a></td>
        
		<td width="15%" align=center><a style='cursor:hand;color:red;text-decoration: none' href="frmdsVTNoibo.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>"><%=FormatDate(Rec("ngayky"))%></a></td>
		<td width="60%"><a style='cursor:hand;color:red;text-decoration: none' href="frmdsVTNoibo.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("IDNoibo")%>&bNam=<%=year(Rec("ngayky"))%>"><%=Rec("trichyeu")%></a></td>
      </tr>
      <%end if%>
		<%
			if  Session("VanBan")="" then
				Session("VanBan")="-" & Rec("IDNoibo") 
			else
				Session("VanBan")=Session("VanBan") & "-" & Rec("IDNoibo")
			end if
		%>
<%		STT=STT+1
		Rec.MoveNext
		cnt=cnt+1
		howmanyrecs=howmanyrecs+1
	loop
		Session("VanBan")=Session("VanBan") & "-" 
	End if
	rec.Close
	set rec=nothing
%>
    </table>
  
</form>

  <%
Response.Write "<font face='Arial'>" 
response.write "<Table width='100%'>"
response.write "<TR>"
response.write "<TD width='15%'>"
response.write "<p align=left>Trang:  " & cstr(nPage) & "/" & cstr(nPageCount)
response.write "</TD>"
response.write "<TD>"  
response.write "<p align=center>"
for counter=1 to nPageCount
	if bComm<>"search"  then
		txt="&nbsp;<a href='frmdsvtnoibo.asp?page="+ cstr(counter)+ "&bComm='>" & counter & "</a>&nbsp;"
	else
		txt="&nbsp;<a href='frmdsvtnoibo.asp?page="+ cstr(counter)+ "&bComm=search&TxtSogoc="+bSoghinhan+"&TxtTungay="+bTungay+"&TxtDenngay="+bdenngay+"&TxtTukhoa="+bTukhoa+"&TxtTrichyeu="+bTrichyeu+"'>" & counter & "</a>&nbsp;"
	end if
	response.write(txt)
	if (counter mod 20)=0 then
		Response.write "<br>"
	end if
next
Response.Write "</font>" 
response.write "</TD>"
response.write "</TR>"
response.write "</Table>"
%>  
</font>  
</body>
<%
	Conn.Close
	set Conn=nothing
%>